package com.gky.gkytemplate.listeners;


import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class RabbitMQListener {

    @RabbitListener(queues = "simple.queue")
    public void listenSimpleQueueMessage(String msg) {
        log.info("消费者接收到消息{}", msg);
    }

    @RabbitListener(queues = "fanout.queue1")
    public void listenSimpleQueueMessage1(String msg) {
        log.info("消费者接收到消息{}", msg);
    }

//    @RabbitListener(bindings = @QueueBinding(
//            value = @Queue("direct.queue1"),
//            exchange = @Exchange("direct.exchange"),
//            key = {"red", "blue"}))
//    public void listenSimpleQueueMessage2(String msg) {
//        log.info("消费者接收到消息{}", msg);
//    }

}
